home *** CD-ROM | disk | FTP | other *** search
/ PC User 2003 May / Disc 2 / PCU0503CD2.iso / Crystal / Samples / CPP / 32bit / Mycall / AREACMBO.CPP next >
Encoding:
C/C++ Source or Header  |  1998-02-18  |  2.2 KB  |  89 lines

  1. // AreaCombo.cpp : implementation file
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "mycall.h"
  6. #include "../../crpe.h"
  7. #include "AreaCmbo.h"
  8.  
  9. #ifdef _DEBUG
  10. #define new DEBUG_NEW
  11. #undef THIS_FILE
  12. static char THIS_FILE[] = __FILE__;
  13. #endif
  14.  
  15. /////////////////////////////////////////////////////////////////////////////
  16. // CAreaCombo
  17.  
  18. CAreaCombo::CAreaCombo()
  19. {
  20. }
  21.  
  22. CAreaCombo::~CAreaCombo()
  23. {
  24. }
  25.  
  26.  
  27. BEGIN_MESSAGE_MAP(CAreaCombo, CComboBox)
  28.     //{{AFX_MSG_MAP(CAreaCombo)
  29.     ON_CONTROL_REFLECT(CBN_SELCHANGE, OnSelchange)
  30.     //}}AFX_MSG_MAP
  31. END_MESSAGE_MAP()
  32.  
  33. /////////////////////////////////////////////////////////////////////////////
  34. // CAreaCombo message handlers
  35. // This function will initialize the combobox's attributes.
  36. void CAreaCombo::InitializeAreaCombo(CCursorBox* cursorCombo, CRPEJob* crpeJob)
  37. {
  38.     m_job = crpeJob;
  39.     m_CursorBox = cursorCombo;
  40. }
  41. /* When selection has changed in the area combobox, perform a PEGetTrackCursor Info 
  42. and then update the Cursor Combobox to have the returned cursor for the specified 
  43. area selected. 
  44. */
  45. void CAreaCombo::OnSelchange() 
  46. {
  47.     // TODO: Add your control notification handler code here
  48.     PETrackCursorInfo trackCursor;
  49.     trackCursor.StructSize = PE_SIZEOF_TRACK_CURSOR_INFO;
  50.     PEGetTrackCursorInfo(m_job->GetJobHandle(), &trackCursor);
  51.     // calling set item of cursor combobox to have the appropriate cursor selected.
  52.     switch(GetCurSel()){
  53.     case 0:
  54.         m_CursorBox->SetItem(trackCursor.groupAreaCursor);
  55.         break;
  56.     case 1:
  57.         m_CursorBox->SetItem(trackCursor.groupAreaFieldCursor);
  58.         break;
  59.     case 2:
  60.         m_CursorBox->SetItem(trackCursor.detailAreaCursor);
  61.         break;
  62.     case 3:
  63.         m_CursorBox->SetItem(trackCursor.detailAreaFieldCursor);
  64.         break;
  65.     case 4:
  66.         m_CursorBox->SetItem(trackCursor.graphCursor);
  67.         break;
  68.     default:
  69.         break;
  70.     }
  71. }
  72. /* return the current selected value in the area combo box.  This function will
  73. aid in the update of this application if the contents of the area combo box is
  74. modified.
  75. */
  76. int CAreaCombo::GetCurrentSel()
  77. {
  78.     return (GetCurSel());
  79. }
  80.  
  81. // clear all of the combobox's attributes, disable, and remove the selected value.
  82. void CAreaCombo::ClearVars()
  83. {
  84.     m_job = NULL;
  85.     m_CursorBox = NULL;
  86.     SetCurSel(-1);
  87.     EnableWindow(FALSE);
  88. }
  89.